﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml.Linq;
using System.Linq;

namespace ActivityTracker.Library
{
    public class TipsAndTricks
    {
        public string GetTipsText(int tipId, out string tipLink, out string tipLinkContent)
        {
            string tipText = "";
            tipLink = "";
            tipLinkContent = "";
            try
            {
                XDocument xdoc = XDocument.Load("DefaultData/TipsAndTricks.xml");
                var tips = from i in xdoc.Descendants("tips") where i.Attribute("id").Value == tipId.ToString() select i;
                foreach (var ti in tips)
                {
                    tipText = ti.Element("name").Value;
                    tipLink = ti.Element("link").Value;
                    tipLinkContent = ti.Element("linkContent").Value;
                }
            }
            catch (Exception ex)
            {
                Exception exNew = new Exception("Exception in GetTipsText Method In ActivityTracker.Library.TipsAndTricks.TipsAndTricks file\n\n" + ex.Message + " \n\n Stack Trace \n" + ex.StackTrace);
                throw exNew;
            }
            return tipText;
        }
    }
}
